package com.shuai.controller;

import com.shuai.entity.File;
import com.shuai.result.Result;
import com.shuai.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/file")
@Slf4j
@Api(tags = "文件相关接口")
public class FileController {
    @Autowired
    private FileService fileService;

    @Autowired
    private RedisTemplate redisTemplate;

    /**
     * 根据项目id查询菜品
     *
     * @param projectId
     * @return
     */
    @GetMapping("/list/{projectId}")
    @ApiOperation("根据项目id查询项目文件")
    public Result<List<File>> list(@PathVariable Long projectId) {
        log.info("根据项目id查");
        List<File> list = fileService.list(projectId);
        return Result.success(list);
    }
}
